import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class SecondDescentService {

  serviceUrls: any = {
    descentListUrl: '/rechargePromotionInfo/list', // 直降促销 List
    descentRecordListUrl: '/rechargePromotionInfoLog/list', // 直降促销记录
    cancelOrderUrl: '/mallOrder/cancelOrder', // 取消订单

    addDescentUrl: '/rechargePromotionInfo/save', // 新增 直降促销
    updateDescentUrl: '/rechargePromotionInfo/update', // 修改 直降促销
    descentDetailUrl: '/rechargePromotionInfo/details', // 直降促销详情
  };

  constructor(public httpClient: HttpClient) { }

  // 直降促销 List
  getdescentList(params: any) {
    return this.httpClient.post(this.serviceUrls.descentListUrl, params).toPromise();
  }

  // 新增 直降促销
  addDescentItem(params: any) {
    return this.httpClient.post(this.serviceUrls.addDescentUrl, params).toPromise();
  }

  // 修改 直降促销
  updateDescentItem(params: any) {
    return this.httpClient.post(this.serviceUrls.updateDescentUrl, params).toPromise();
  }

  // 直降促销 详情Details
  getDescentDetail(params: any) {
    return this.httpClient.post(this.serviceUrls.descentDetailUrl, params).toPromise();
  }

  /**
   * 直降促销记录
   * ----------------------------------------------------------------
   */

  // 促销记录 List
  getDescentRecordList(params: any) {
    return this.httpClient.post(this.serviceUrls.descentRecordListUrl, params).toPromise();
  }

  // 取消订单
  cancelOrderData(params: any) {
    return this.httpClient.post(this.serviceUrls.cancelOrderUrl, params).toPromise();
  }
}



